    .text                     # Start text section
    #.balign 4                # align section to 4 bytes - which is also the default?
    .global solve         # define global function symbol
solve:

	mv a4, a3
loop:
	vsetvli a3, a0, e16, m4, ta, ma
	vle16.v v4, (a1)
	slli t1, a3, 1
	add a1, a1, t1
	vwmul.vx v8, v4, a4

	vsetvli x0, x0, e32, m8, ta, ma
	vsrl.vi v8, v8, 3
	vse32.v v8, (a2) 
	slli t1, a3, 2
        add a2, a2, t1
	sub a0, a0, a3
	bnez a0, loop
        ret
